<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>双十一8.5折优惠来袭</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    .bg {
        font-size: 0;
        max-width: 1000px;
        margin: 0 auto;
    }

    /*包含以下四种的链接*/
    a {
        text-decoration: none;
    }

    /*正常的未被访问过的链接*/
    a:link {
        text-decoration: none;
    }

    /*已经访问过的链接*/
    a:visited {
        text-decoration: none;
    }

    /*鼠标划过(停留)的链接*/
    a:hover {
        text-decoration: none;
    }

    /* 正在点击的链接*/
    a:active {
        text-decoration: none;
    }

</style>
<body>
<div class="bg">
    <img src="{$oss}active/web/images/eleven2020-1.png" style="max-width:100%;">
    <img src="{$oss}active/web/images/eleven2020-1-2.png" style="max-width:100%;">
    <a class="button_report" onclick="js_method('{$host}/report_index?need_auth=1',1)" ><img src="{$oss}active/web/images/eleven_btn2020-1.png" style="max-width: 100%;"></a>
    <img src="{$oss}active/web/images/elven2020-2-new.png" style="max-width: 100%;">
    <a class="button_fortune" onclick="js_method('{$host}/day?need_auth=1',2)"><img src="{$oss}active/web/images/eleven_btn2020-2.png" style="max-width: 100%;"></a>
    <img src="{$oss}active/web/images/eleven2020-3.png" style="max-width: 100%;">
    <a class="button_fortune" onclick="js_method('{$host}/fortune_for_month?need_auth=1',2)" ><img src="{$oss}active/web/images/eleven_btn2020-3.png" style="max-width: 100%;"></a>
    <img src="{$oss}active/web/images/eleven2020-4.png" style="max-width: 100%;">
    <a class="button_fortune" onclick="js_method('{$host}/fortune_for_year?need_auth=1',2)" ><img src="{$oss}active/web/images/eleven_btn2020-4.png" style="max-width: 100%;"></a>
    <img src="{$oss}active/web/images/eleven2020-5.png" style="max-width: 100%;">
    <a class="button_map" onclick="js_method('{$host}/acg_map?need_auth=1',3)" ><img src="{$oss}active/web/images/eleven_btn2020-5.png" style="max-width: 100%;"></a>
    <img src="{$oss}active/web/images/eleven2020-6.png" style="max-width: 100%;">
</div>
</body>
<script src="/static/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
    /**
     * 弹窗
     * @param msg
     * @param duration
     * @constructor
     */
    function Toast(msg,duration){
        duration=isNaN(duration)?3000:duration;
        var m = document.createElement('div');
        m.innerHTML = msg;
        m.style.cssText="width:270px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;margin-left: -135px; margin-top:-20px";
        document.body.appendChild(m);
        setTimeout(function() {
            m.style.opacity = '0';
            setTimeout(function() { document.body.removeChild(m) }, d * 1000);
        }, duration);
    }

    var timestamp = Math.ceil(((new Date()).getTime()) / 1000);//获取当前秒级时间戳
    var reportStartTime = 1604332800;//2020-11-03 报告活动开始时间
    var FortuneStartTime = 1604505600;//2020-11-05 运势活动开始时间
    var mapStartTime = 1604937600;//2020-11-10  地图活动开始时间
    var endTime = 1605110400;//2020-11-12  活动结束时间
    var setTimeoutDuration = 1500;//弹窗显示时长
    var startText = '活动马上开始，耐心等待一下哦!';//活动开始文案
    var endText = '活动已结束';//活动结束文案

    /**
     * 点击事件
     * @param href
     * @param type
     */
    function js_method(href,type)
    {
        switch (type)
        {
            case 1 ://1604332800 2020-11-03  到  1605110400 2020-11-12
                if (timestamp >= reportStartTime && timestamp < endTime) {
                    $('.button_report').attr({href:href, target:"_blank"})
                }else{
                    if (timestamp <reportStartTime) {
                        Toast(startText, setTimeoutDuration)
                    }else if (timestamp > endTime)
                    {
                        Toast(endText,setTimeoutDuration)
                    }
                }
                break;
            case 2: //1604505600 2020-11-05    到  1605110400 2020-11-12
                if (timestamp >= FortuneStartTime && timestamp < endTime) {
                    $('.button_fortune').attr({href:href, target:"_blank"})
                }else{
                    if (timestamp <FortuneStartTime) {
                        Toast(startText, setTimeoutDuration)
                    }else if (timestamp > endTime)
                    {
                        Toast(endText,setTimeoutDuration)
                    }
                }
                break;
            case 3: //1604937600 2020-11-10   到  1605110400 2020-11-12
                if (timestamp >= mapStartTime && timestamp < endTime) {
                    $('.button_map').attr({href:href, target:"_blank"})
                }else{
                    if (timestamp <mapStartTime) {
                        Toast(startText, setTimeoutDuration)
                    }else if (timestamp > endTime)
                    {
                        Toast(endText,setTimeoutDuration)
                    }
                }
                break;
            default :
                Toast(endText,setTimeoutDuration)
                break;
        }
    }
</script>
{include file="../apps/web/view/public/sensors.html" /}
</html>
